package com.springcloud.eshop.datasync.rabbitmq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @Desc:
 * @Date: 2020-06-29
 * @Version:v1.0
 */
@Repository
public class RabbitmqProvider {

    private Logger logger = LoggerFactory.getLogger(RabbitmqProvider.class);

    @Autowired
    private AmqpTemplate amqpTemplate;

    /**
     * @Desc: 发送消息
     * @Param topic
     * @Param message
     * @Return void
     * @Date: 2020/7/2
     */
    public void sendMessage(String topic, String message) {
        this.amqpTemplate.convertAndSend(topic, message);
    }
}
